package com.bayss.core.constant;

/**
 * 请求公共上下文对象
 * @author yangjian9
 *
 */
public class ResultMsg<T> {
    private static final Integer successCode = 200;
    private static final String successMsg = "提交成功";
    private String msg;
    private Integer status;
    private T data;

    public ResultMsg(T data, Integer status,String msg) {
        this.msg = msg;
        this.status = status;
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


    public static ResultMsg fail(int status, String msg) {
        return new ResultMsg<>(null, status, msg);
    }

    public static ResultMsg success(Object data) {
        return new ResultMsg<>(data, successCode, successMsg);
    }

    public static ResultMsg success() {
        return new ResultMsg<>(null, successCode, successMsg);
    }
}
